<script type="text/javascript" language="javascript" charset="utf-8">
$(".menu-wrap li").removeClass("active-link");
$(".menu-wrap #teacher").addClass("active-link");
</script>
<div class="mask">
</div>
<div class="common-tit">
  <h2><%= @teacher_name %>-课表</h2>
  <span>导师列表 > 课表</span>
  <div class="cours-gbtn">
    <!-- 前台权限控制 flydragon -->
    <% if !current_user.is_receptionist? %>
      <%= link_to "购买私教", appointment_admin_course_week_path(),remote: true  %>
    <% end %>
    <%= link_to "预约私教", appointment_admin_course_week_path(),remote: true  %>
  </div>
</div>
<div class="cur-list">
  <div class="atten-co at-nb">
    <div class="timea-box">
      <div class="atten-sel">星期一<em></em></div>
      <div>星期二<em></em></div>
      <div>星期三<em></em></div>
      <div>星期四<em></em></div>
      <div>星期五<em></em></div>
      <div>星期六<em></em></div>
      <div>星期日<em></em></div>
    </div>
    <div class="prev-week">上一周</div>
    <div class="next-week">下一周</div>
  </div>
  <div class="curlist-con">
    <div class="scrollbox" id="weekBox">
      <table>
        <thead>
          <tr>
            <th class="timeta-name">课程名称</th>
            <th class="timeta-type">课程类型</th>
            <th class="timeta-tea">导师</th>
            <th class="timeta-time">时间</th>
            <th class="timeta-class">教室</th>
            <th class="curl-operation">操作</th>
          </tr>
        </thead>
        <tbody>
          <% @monday.each do |course| %>
            <tr>
              <td><%= course.course_info.name %></td>
              <td><%= course.course_info.course_type %></td>
              <td><%= course.course_info.teacher.name %></td>
              <td><%= course.course_time.strftime("%Y-%m-%d %H:%M") %></td>
              <td><%= course.course_info.room.room_name %></td>
              <td class="curl-operation">
                <span>[</span>
                <em><%= link_to "查看详情", action: "get_course_week_detail", id: course.id %></em>
                <span>]</span>
                <!-- ,导师模块－查看导师周表，只有查看详情模块 kevin -->
                <!-- <span>[</span>
                <% if course.course_info.course_type == "私教" %>
                <em><%= link_to "学员签到", new_private_check_in_admin_course_week_path(course),remote: true %></em>
                <%else%>
                <em><%= link_to "学员签到", student_check_admin_course_week_path(course),remote: true %></em>
                <%end%>
                <span>]</span>
                <% unless course.teacher_checked(course.course_info.teacher) %>
                  <span>[</span>
                  <em><%= link_to "导师签到", teacher_check_admin_course_week_path(course),remote: true %></em>
                  <span>]</span>
                <%end%> -->
              </td>
            </tr>
          <%end%>
        </tbody>
      </table>
      <!-- 2 -->
      <table>
        <thead>
          <tr>
            <th class="timeta-name">课程名称</th>
            <th class="timeta-type">课程类型</th>
            <th class="timeta-tea">导师</th>
            <th class="timeta-time">时间</th>
            <th class="timeta-class">教室</th>
            <th class="curl-operation">操作</th>
          </tr>
        </thead>
        <tbody>
          <% @tuesday.each do |course| %>
            <tr>
              <td><%= course.course_info.name %></td>
              <td><%= course.course_info.course_type %></td>
              <td><%= course.course_info.teacher.name %></td>
              <td><%= course.course_time.strftime("%Y-%m-%d %H:%M") %></td>
              <td><%= course.course_info.room.room_name %></td>
              <td class="curl-operation">
                <span>[</span>
                <em><%= link_to "查看详情", action: "get_course_week_detail", id: course.id %></em>
                <span>]</span>
                <!-- ,导师模块－查看导师周表，只有查看详情模块 kevin -->
                <!-- <span>[</span>
                <% if course.course_info.course_type == "私教" %>
                <em><%= link_to "学员签到", new_private_check_in_admin_course_week_path(course),remote: true %></em>
                <%else%>
                <em><%= link_to "学员签到", student_check_admin_course_week_path(course),remote: true %></em>
                <%end%>
                <span>]</span>
                <% unless course.teacher_checked(course.course_info.teacher) %>
                  <span>[</span>
                  <em><%= link_to "导师签到", teacher_check_admin_course_week_path(course),remote: true %></em>
                  <span>]</span>
                <%end%> -->
              </td>
            </tr>
          <%end%>
        </tbody>
      </table>
      <!-- 3 -->
      <table>
        <thead>
          <tr>
            <th class="timeta-name">课程名称</th>
            <th class="timeta-type">课程类型</th>
            <th class="timeta-tea">导师</th>
            <th class="timeta-time">时间</th>
            <th class="timeta-class">教室</th>
            <th class="curl-operation">操作</th>
          </tr>
        </thead>
        <tbody>
          <% @wednesday.each do |course| %>
            <tr>
              <td><%= course.course_info.name %></td>
              <td><%= course.course_info.course_type %></td>
              <td><%= course.course_info.teacher.name %></td>
              <td><%= course.course_time.strftime("%Y-%m-%d %H:%M") %></td>
              <td><%= course.course_info.room.room_name %></td>
              <td class="curl-operation">
                <span>[</span>
                <em><%= link_to "查看详情", action: "get_course_week_detail", id: course.id %></em>
                <span>]</span>
                <!-- ,导师模块－查看导师周表，只有查看详情模块 kevin -->
                <!-- <span>[</span>
                <% if course.course_info.course_type == "私教" %>
                <em><%= link_to "学员签到", new_private_check_in_admin_course_week_path(course),remote: true %></em>
                <%else%>
                <em><%= link_to "学员签到", student_check_admin_course_week_path(course),remote: true %></em>
                <%end%>
                <span>]</span>
                <% unless course.teacher_checked(course.course_info.teacher) %>

                  <span>[</span>
                  <em><%= link_to "导师签到", teacher_check_admin_course_week_path(course),remote: true %></em>
                  <span>]</span>
                <%end%> -->
              </td>
            </tr>
          <% end -%>
        </tbody>
      </table>
      <!-- 4 -->
      <table>
        <thead>
          <tr>
            <th class="timeta-name">课程名称</th>
            <th class="timeta-type">课程类型</th>
            <th class="timeta-tea">导师</th>
            <th class="timeta-time">时间</th>
            <th class="timeta-class">教室</th>
            <th class="curl-operation">操作</th>
          </tr>
        </thead>
        <tbody>
          <% @thursday.each do |course| %>
            <tr>
              <td><%= course.course_info.name %></td>
              <td><%= course.course_info.course_type %></td>
              <td><%= course.course_info.teacher.name %></td>
              <td><%= course.course_time.strftime("%Y-%m-%d %H:%M") %></td>
              <td><%= course.course_info.room.room_name %></td>
              <td class="curl-operation">
                <span>[</span>
                <em><%= link_to "查看详情", action: "get_course_week_detail", id: course.id %></em>
                <span>]</span>
                <!-- ,导师模块－查看导师周表，只有查看详情模块 kevin -->
                <!-- <span>[</span>
                <% if course.course_info.course_type == "私教" %>
                <em><%= link_to "学员签到", new_private_check_in_admin_course_week_path(course),remote: true %></em>
                <%else%>
                <em><%= link_to "学员签到", student_check_admin_course_week_path(course),remote: true %></em>
                <%end%>
                <span>]</span>
                <% unless course.teacher_checked(course.course_info.teacher) %>

                  <span>[</span>
                  <em><%= link_to "导师签到", teacher_check_admin_course_week_path(course),remote: true %></em>
                  <span>]</span>
                <%end%> -->
              </td>
            </tr>
          <%end%>
        </tbody>
      </table>
      <!-- 5 -->
      <table>
        <thead>
          <tr>
            <th class="timeta-name">课程名称</th>
            <th class="timeta-type">课程类型</th>
            <th class="timeta-tea">导师</th>
            <th class="timeta-time">时间</th>
            <th class="timeta-class">教室</th>
            <th class="curl-operation">操作</th>
          </tr>
        </thead>
        <tbody>
          <% @friday.each do |course| %>
            <tr>
              <td><%= course.course_info.name %></td>
              <td><%= course.course_info.course_type %></td>
              <td><%= course.course_info.teacher.name %></td>
              <td><%= course.course_time.strftime("%Y-%m-%d %H:%M") %></td>
              <td><%= course.course_info.room.room_name %></td>
              <td class="curl-operation">
                <span>[</span>
                <em><%= link_to "查看详情", action: "get_course_week_detail", id: course.id %></em>
                <span>]</span>
                <!-- ,导师模块－查看导师周表，只有查看详情模块 kevin -->
                <!-- <span>[</span>
                <% if course.course_info.course_type == "私教" %>
                <em><%= link_to "学员签到", new_private_check_in_admin_course_week_path(course),remote: true %></em>
                <%else%>
                <em><%= link_to "学员签到", student_check_admin_course_week_path(course),remote: true %></em>
                <%end%>
                <span>]</span>
                <% unless course.teacher_checked(course.course_info.teacher) %>
                  <span>[</span>
                  <em><%= link_to "导师签到", teacher_check_admin_course_week_path(course),remote: true %></em>
                  <span>]</span>
                <%end%> -->
              </td>
            </tr>
          <% end -%>
        </tbody>
      </table>
      <!-- 6 -->
      <table>
        <thead>
          <tr>
            <th class="timeta-name">课程名称</th>
            <th class="timeta-type">课程类型</th>
            <th class="timeta-tea">导师</th>
            <th class="timeta-time">时间</th>
            <th class="timeta-class">教室</th>
            <th class="curl-operation">操作</th>
          </tr>
        </thead>
        <tbody>
          <% @saturday.each do |course| %>
            <tr>
              <td><%= course.course_info.name %></td>
              <td><%= course.course_info.course_type %></td>
              <td><%= course.course_info.teacher.name %></td>
              <td><%= course.course_time.strftime("%Y-%m-%d %H:%M") %></td>
              <td><%= course.course_info.room.room_name %></td>
              <td class="curl-operation">
                <span>[</span>
                <em><%= link_to "查看详情", action: "get_course_week_detail", id: course.id %></em>
                <span>]</span>
                <!-- ,导师模块－查看导师周表，只有查看详情模块 kevin -->
                <!-- <span>[</span>
                <% if course.course_info.course_type == "私教" %>
                <em><%= link_to "学员签到", new_private_check_in_admin_course_week_path(course),remote: true %></em>
                <%else%>
                <em><%= link_to "学员签到", student_check_admin_course_week_path(course),remote: true %></em>
                <%end%>
                <span>]</span>
                <% unless course.teacher_checked(course.course_info.teacher) %>
                  <span>[</span>
                  <em><%= link_to "导师签到", teacher_check_admin_course_week_path(course),remote: true %></em>
                  <span>]</span>
                <%end%> -->
              </td>
            </tr>
          <% end -%>
        </tbody>
      </table>
      <!-- 7 -->
      <table>
        <thead>
          <tr>
            <th class="timeta-name">课程名称</th>
            <th class="timeta-type">课程类型</th>
            <th class="timeta-tea">导师</th>
            <th class="timeta-time">时间</th>
            <th class="timeta-class">教室</th>
            <th class="curl-operation">操作</th>
          </tr>
        </thead>
        <tbody>
          <% @sunday.each do |course| %>
            <tr>
              <td><%= course.course_info.name %></td>
              <td><%= course.course_info.course_type %></td>
              <td><%= course.course_info.teacher.name %></td>
              <td><%= course.course_time.strftime("%Y-%m-%d %H:%M") %></td>
              <td><%= course.course_info.room.room_name %></td>
              <td class="curl-operation">
                <span>[</span>
                <em><%= link_to "查看详情", action: "get_course_week_detail", id: course.id %></em>
                <span>]</span>
                <!-- ,导师模块－查看导师周表，只有查看详情模块 kevin -->
                <!-- <span>[</span>
                <% if course.course_info.course_type == "私教" %>
                <em><%= link_to "学员签到", new_private_check_in_admin_course_week_path(course),remote: true %></em>
                <%else%>
                <em><%= link_to "学员签到", student_check_admin_course_week_path(course),remote: true %></em>
                <%end%>
                <span>]</span>
                <% unless course.teacher_checked(course.course_info.teacher) %>
                  <span>[</span>
                  <em><%= link_to "导师签到", teacher_check_admin_course_week_path(course),remote: true %></em>
                  <span>]</span>
                <%end%> -->
              </td>
            </tr>
          <% end -%>
        </tbody>
      </table>
    </div>
  </div>
</div>
<script src="/assets/js/common.js"></script>
<script>
(function() {
  var showDay;
  var a = new Date().getDay();
  $(".timea-box div").removeClass("atten-sel");
  switch(true) {
    case a == 0: showDay = 6;break;
    case a == 1: showDay = 0;break;
    case a == 2: showDay = 1;break;
    case a == 3: showDay = 2;break;
    case a == 4: showDay = 3;break;
    case a == 5: showDay = 4;break;
    case a == 6: showDay = 5;break;
  };
  // console.log(showDay);
  $(".timea-box div").eq(showDay).addClass("atten-sel");
  $("#weekBox table").eq(showDay).css({
    "display" : "table"
  });
  var num = 0;
  $(".prev-week").on("click", function() {
    num --;
    if (num < -1) {
      num == -1
    };
    if (num == -1) {
      $(".prev-week").css({
        "display" : "none"
      })
    } else {
      $(".prev-week").css({
        "display" : "block"
      })
    }
    $(".next-week").css({
      "display" : " block"
    });
    // 再此加入 加载上一周
    $.ajax({
      type:'get', url:"/admin/teachers/get_course_week?num="+ num,
      success: function(data) {
        if (data.error) {
          // console.log("wrong");
        } 
      }
    });

    $(".timea-box div").removeClass("atten-sel");
    $(".timea-box div").eq(0).addClass("atten-sel");
    $("#weekBox table").eq(0).css({
      "display" : "table"
    }).siblings().css({
      "display" : "none"
    });
  });
  $(".next-week").on("click", function() {
    num ++;
    if (num > 1) {
      num == 1
    };
    if (num == 1) {
      $(".next-week").css({
        "display" : "none"
      })
    } else {
      $(".next-week").css({
        "display" : "block"
      });
    }
    $(".prev-week").css({
      "display" : " block"
    });
    // 再此加入 加载下一周
    $.ajax({
      type:'get', url:"/admin/teachers/get_course_week?num="+ num,
      success: function(data) {
        if (data.error) {
          // console.log("wrong");
        } 
      }
    });

    $(".timea-box div").removeClass("atten-sel");
    $(".timea-box div").eq(0).addClass("atten-sel");
    $("#weekBox table").eq(0).css({
      "display" : "table"
    }).siblings().css({
      "display" : "none"
    });
  });
})();
$(".timea-box div").on("click", function() {
  $(".timea-box div").removeClass("atten-sel");
  $(this).addClass("atten-sel");
  $(".curlist-con").eq($(this).index()).addClass("sel-curl").siblings().removeClass("sel-curl");
  $("#weekBox table").eq($(this).index()).css({
    "display" : "table"
  }).siblings().css({
    "display" : "none"
  });
})
// 弹窗

/* 单选下拉列表 */
</script>
